using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SysTables
{
    public partial class AlterAttributeForm : Form
    {
        Attribute tmpattrib;

        public AlterAttributeForm()
        {
            InitializeComponent();
        }

        private void AlterAttributeForm_Load(object sender, EventArgs e)
        {

        }

        public void Show(Attribute attr)
        {
            mType.Text = attr.Type.ToString();
            mIsNull.Checked = attr.isNull;
            mLength.Text = attr.Length.ToString();
            tmpattrib = attr;
            ShowDialog();
        }

        public void AlterAttribute(Attribute attr)
        {

            attr.Type =  Attribute.Parse(mType.Text);
            attr.Length =  Common.ParseInt(mLength.Text); 
            attr.isNull =  mIsNull.Checked ;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            AlterAttribute(tmpattrib);
            Visible = false;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Visible = false;
        }
    }
}